package com.example.headfirstprojectdemo.StrategyPattern;

/**
 * 绿头鸭
 */
public class MallardDuck extends Duck {
    public MallardDuck(){
        this.display();
        quackBehaviour = new Quack();
        flyBehaviour = new FlyWithWings();
    }

    public static void main(String[] args) {
        MallardDuck mallardDuck = new MallardDuck();

        mallardDuck.performQuack();
        mallardDuck.performFly();
    }

    @Override
    public void display() {
        System.out.println("大家好！我是绿头鸭");
    }
}
